import React from 'react'
// ===================================================================== Temp
import TableModal from '#cpt/temp/TableModal'
// ===================================================================== Declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const Export = $Lazy.file(()=>import('#private/common/export'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		forms : [
			{ label: '条码号',		name: 'spec_code' },
			{ label: '病人姓名',		name: 'patient_name' },
			{ label: '证件号',		name: 'card_no' },
			{ label: '电话号码',		name: 'patient_phone' },
		]
	}
	
	model = {}
	
	open = ({ status_abnormal_reason, parent_kind_id, project_id,type, start_at, end_at }) => {
		this.modal.open()
		this.query = { status_abnormal_reason, parent_kind_id, project_id,type:0, start_at, end_at }
		// 阻止重复加载数据
		this.fetch()
	}
	
	// paging
	fetch = () => $fn.fetch.call(this, 'statistics/labReportBackDetail')
	
	// 表单
	cols = [
		{ title: '条码号', 		dataIndex: 'spec_code', 		...$fn.table.spec_code },
		{ title: '姓名', 		dataIndex: 'patient_name', 		...$fn.table.name },
		{ title: '性别', 		dataIndex: 'sex_name', 			...$fn.table.sex },
		{ title: '年龄', 		dataIndex: 'age', 				...$fn.table.age },
		{ title: '受检人电话', 	dataIndex: 'patient_phone', 	...$fn.table.phone },
		{ title: '证件类型', 	dataIndex: 'card_type_name', 	...$fn.table.card_type },
		{ title: '证件号', 		dataIndex: 'card_no', 			...$fn.table.idcard },
		{ title: '自然项目', 	dataIndex: 'parent_kind_name', 	width:150 },
		{ title: '检测项目', 	dataIndex: 'kind_name', 		width:150 },
		{ title: '送检医院', 	dataIndex: 'hosp_name', 		width:200 },
		{ title: '实验号', 		dataIndex: 'experiment_num', 	width:100 },
		{ title: '退单原因', 	dataIndex: 'status_abnormal_reason', 		width:150 },
		{ title: '接收时间', 	dataIndex: 'created_at', 		...$fn.table.time },
	]
	
	render(){
		return TableModal.call(this,{ title: '项目明细', labelWidth:'s7', width:'90%', height:'80%', okText:'导出',
			onOk:()=> Export.then(f=>f.call(this,'statistics/labReportBackDetail'))
		})
	}
}

export default Index